<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.longtop.com/intelliweb" prefix="e"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Insert title here</title>
	</head>

	<e:View id="view">
	    <script type="text/javascript" src="<c:url value='/scripts/global.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/scripts/skin.js'/>"></script>
	    <script type="text/javascript">SkinUtil.getSkin();</script>
	    <script type="text/javascript">SkinUtil.getModuleSkin();</script>
    
		<div id="Invisual Controls" style="min-height: 40px; background-color: LemonChiffon;" >
			<e:Dataset id="Dataset_Index" datasetDefinition="DatasetDefinition_zb.dsd" datasetRef="Dataset_Index" pageSize="10" loadDataCommand="Command_Load">
				<e:Field name="indexId" dataType="string" label="指标ID" maxLength="32" />
				 <e:Field name="indexName" dataType="string" label="指标名称" maxLength="100" />
				 <e:Field name="indexDesc" dataType="string" label="指标说明" maxLength="200" />
				 <e:Field name="objectScope" dataType="string" label="适用对象" maxLength="4" dropDown="ListDropDown_objectScope_0006"/>
				 <e:Field name="indexType" dataType="string" label="指标类型" maxLength="1" dropDown="ListDropDown_indexType_0009"/>
				 <e:Field name="indexUnit" dataType="string" label="指标单位" maxLength="1" visible="false"/>
				 <e:Field name="precision" dataType="string" label="计量精度" maxLength="1" visible="false"/>
				 <e:Field name="scale" dataType="string" label="小数位数" maxLength="1" visible="false"/>
				 <e:Field name="statCycle" dataType="string" label="统计周期" maxLength="1" dropDown="ListDropDown_statCycle_0001"/>
				 <e:Field name="saveDate" dataType="string" label="保存日期" maxLength="1" visible="false"/>
				 <e:Field name="doDateType" dataType="string" label="处理日期类型" maxLength="1" visible="false"/>
				 <e:Field name="doDate" dataType="string" label="处理日期" maxLength="10" visible="false"/>
				 <e:Field name="dataSource" dataType="string" label="数据来源" maxLength="1" visible="false"/>
				 <e:Field name="indexLevel" dataType="integer" label="指标等级" maxLength="22" visible="false"/>
				 <e:Field name="formula" dataType="string" label="指标公式" maxLength="4000" visible="false"/>
				 <e:Field name="formulaSql" dataType="string" label="指标公式sql" maxLength="4000" visible="false"/>
				 <e:Field name="sortNo" dataType="integer" label="排序号" maxLength="22" />
				 <e:Field name="remark" dataType="string" label="备注" maxLength="400" />
				 <e:Field name="createOrgId" dataType="string" label="创建机构ID" maxLength="32" visible="false"/>
				 <e:Field name="createOrgName" dataType="string" label="创建机构" maxLength="100" />
				 <e:Field name="createUserId" dataType="string" label="创建人ID" maxLength="32" visible="false"/>
				 <e:Field name="createUserName" dataType="string" label="创建人" maxLength="100" />
				 <e:Field name="createTime" dataType="date" label="创建时间" maxLength="7" />
				 <e:Field name="updateUserName" dataType="string" label="修改人" maxLength="100" />
				 <e:Field name="updateTime" dataType="date" label="修改时间" maxLength="7" />
			</e:Dataset>
			
			<e:Command id="Command_Load" action="com.longtop.perform.zb.index.web.IndexCustomListAction" method="loadIndexCustomList" showHintInfoOnSuccess="false">
				<e:DatasetInfo name="DatasetInfo1" dataset="Dataset_Index" alwayRefreshClient="true"></e:DatasetInfo>
			</e:Command>
			<e:Command id="Command_Search" action="com.longtop.perform.zb.index.web.IndexCustomListAction" method="searchIndexCustomList" submitForm="true" submitFormScope="all" validateRequired="true">
				<e:DatasetInfo name="DatasetInfo2" dataset="Dataset_Index" alwayRefreshClient="true" submitType="none"></e:DatasetInfo>
			</e:Command>
			<e:Command id="Command_Delete" action="com.longtop.perform.zb.index.web.IndexCustomListAction" method="deleteIndexCustom" validateRequired="true" 
					onExecuteSuccess="Command_Delete_onExecuteSuccess(command)" showHintInfoOnSuccess="false">
				<e:DatasetInfo name="DatasetInfo3" dataset="Dataset_IndexCustom" alwayRefreshClient="false" submitType="changes"></e:DatasetInfo>
			</e:Command>

			<e:ListDropDown id="ListDropDown_EPFlg" autoDropDown="true" fixed="true">
				<e:ListDropDownItem name="ListDropDownItem1" label="对公指标" value="0" />
				<e:ListDropDownItem name="ListDropDownItem2" label="零售指标" value="1" />
			</e:ListDropDown>
			<e:ListDropDown id="ListDropDown_IndexUnit" autoDropDown="true" fixed="true">
			</e:ListDropDown>
			<e:ListDropDown id="ListDropDown_IndexCycle" autoDropDown="true" fixed="true">
			</e:ListDropDown>
		</div>

		<body>
			<e:Page id="ePage" action="com.longtop.perform.zb.index.web.IndexCustomListAction" style="min-height: 80px; width: 100%; height: 100%;">
				<table style="width: 100%; height: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
					<tr>
						<td valign="top" width="100%">
							<table style="text-align: left; width: 100%;" border="0" cellpadding="3" cellspacing="3" >
								<tr>
									<td>
										<e:GroupBox id="GroupBox1" caption="查询条件" style="height: 100%; width:100%;">
											<table style="text-align: left; width: 100%;" border="0" cellpadding="3" cellspacing="3" width="100%" align="center">
												<tr>
													<td align="right" nowrap="nowrap">
														<e:Label id="Label_indexId" caption="复合指标ID"></e:Label>
													</td>
													<td align="left">
														<e:Text id="Text_indexId" style="width:200px;"></e:Text>
													</td>
													<td align="right" nowrap="nowrap">
														<e:Label id="Label_indexName" caption="复合指标名称"></e:Label>
													</td>
													<td align="left">
														<e:Text id="Text_indexName" style="width:200px;"></e:Text>
													</td>
													<td align="left" width="99%">
														<e:Button id="Button_Search" style='height: 22px; width: 70px' caption="查询" command="Command_Search" icon="/images/query.gif" onClick="Button_Search_onClick()"></e:Button>
													</td>
												</tr>
											</table>
										</e:GroupBox>
									</td>
								</tr>	
								<tr>
									<td>
										<table style="text-align: right; width: 100%;" border="0" cellpadding="0" cellspacing="0">
											<tr>
												<td height="27px" width="1%">
													<e:RecordNavigator id="RecordNavigator_Index" dataset="Dataset_Index" showNavigatorButton="false">
														<e:RecordButton id="RecordButton_insert" label="新增" onClick="RecordButton_Insert_onClick()" icon="/images/add.gif"></e:RecordButton>
														<e:RecordButton id="RecordButton_Edit" label="编辑" onClick="RecordButton_Edit_onClick()" icon="/images/edit.gif"></e:RecordButton>
														<e:RecordButton id="RecordButton_Delete" label="删除" onClick="RecordButton_Delete_onClick()" icon="/images/delete.gif"></e:RecordButton>
													</e:RecordNavigator>
												</td>
												<td align="left" width="99%"><e:PageNavigator id="PageNavigator_Index" dataset="Dataset_Index" showRecordNum="true"></e:PageNavigator></td>
											</tr>
										</table>
									</td>
								</tr>
								<tr>
									<td>
										<e:Grid id="Grid_Index" style="width: 100%; height: 100%;" showIndex="true" dataset="Dataset_Index" readOnly="true" onDblClick="Grid_Index_onDblClick()">
										</e:Grid>
									</td>
								</tr>
							</table>
						</td>
					</tr>
			    </table>
			</e:Page>
		</body>
	</e:View>
</html>	

<script type="text/javascript">
	// 查询
	function Button_Search_onClick(){
	    Command_Search.execute();
	}
	// 新增
	function RecordButton_Insert_onClick(){
		var path = "/jsp/perform/zb/index/indexCustomEdit.jsp?doflag="+"insert";
		openTab("indexCustom_insert","新增复合指标",path);
	}
	// 编辑
	function RecordButton_Edit_onClick(){
		var record = Dataset_IndexCustom.getCurrentRecord();
		if(record){
			var id = record.getValue("id");
			if(id != null && id != ''){
				var path = "/jsp/perform/zb/index/indexCustomEdit.jsp?id="+id+"&doflag="+"edit";
				openTab("indexCustom_edit","编辑复合指标",path);
			}
		}
	}
	// 双击表格查看
	function Grid_Result_onDblClick(){
		RecordButton_Edit_onClick();
	}
	// 删除复合指标
	function RecordButton_Delete_onClick(){
		var record = Dataset_Index.getCurrentRecord();
		if(record){
			var indexId = record.getValue("indexId");	//指标id
			if(indexId != null && indexId != ''){
				if(window.confirm("您确定要删除当前选中的复合指标吗？")){
					Command_Delete.parameters.setValue("indexId",indexId);
					Command_Delete.execute();
				}
			}
		}
	}
	// 删除成功
	function Command_Delete_onExecuteSuccess(command){
		alert("操作成功！");
		var record = Dataset_Index.getCurrentRecord();
		if(record){
			Dataset_Index.deleteRecord(record);
		}
	}
</script>